import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      component: resolve => require(['@/components/page/login'],resolve),
      meta: { title: '登陆' }
    },
    {
      path: '/register',
      component: resolve => require(['@/components/page/register/register'],resolve),
      meta: { title: '注册' },
      children: [
        {
          path: '/getCode',
          component: resolve => require(['@/components/page/register/getCode/getCode'],resolve),
          meta: { title: '获取验证码' }
        },
        {
          path: '/setPassword',
          component: resolve => require(['@/components/page/register/setPassword/setPassword'],resolve),
          meta: { title: '设置密码' }
        },
        {
          path: '/setFinish',
          component: resolve => require(['@/components/page/register/setFinish/setFinish'],resolve),
          meta: { title: '设置完成' }
        }
      ]
    },
    {
      path: '/beSettled',
      component: resolve => require(['@/components/page/beSettled/beSettled'],resolve),
      meta: { title: '入驻' },
      children: [
        {
          path: '/introduce',
          component: resolve => require(['@/components/page/beSettled/introduce/introduce'],resolve),
          meta: { title: '申请入驻' }
        },
        {
          path: '/settleForm',
          component: resolve => require(['@/components/page/beSettled/settleForm/settleForm'],resolve),
          meta: { title: '提交资质' }
        }
      ]
    },
    {
      path: '/home',
      component: resolve => require(['@/components/common/home'],resolve), 
      meta: { title: '自述文件' },
      children: [
        {
          path: '/index',
          component: resolve => require(['@/components/page/index/index'],resolve),
          meta: { title: '首页' },
          children: []
        },
        {
          path: '/shop',
          component: resolve => require(['@/components/page/shop/shop'],resolve), 
          children: [
            {
              path: '/goodsList',
              component: resolve => require(['@/components/page/shop/goodsList/goodsList'],resolve),
              meta: { title: '商品列表' },
              children: []
            },
            {
              path: '/shopInfo',
              component: resolve => require(['@/components/page/shop/shopInfo/shopInfo'],resolve),
              meta: { title: '店铺信息' },
              children: []
            }
          ]
        },
        {
          path: '/privilege',
          component: resolve => require(['@/components/page/privilege/privilege'],resolve),
          children: [
            {
              path: '/clerkList',
              component: resolve => require(['@/components/page/privilege/clerkList/clerkList'],resolve),
              meta: { title: '店员列表' }
            }
          ]
        },
        {
          path: '/information',
          component: resolve => require(['@/components/page/information/information'],resolve),
          children: []
        },
        {
          path: '/article',
          component: resolve => require(['@/components/page/article/article'],resolve), 
          children: [                  
            {
              path: '/publish',
              component: resolve => require(['@/components/page/article/publish/publish'],resolve),
              meta: { title: '发布文章' }
            },           
            {
              path: '/articleList',
              component: resolve => require(['@/components/page/article/articleList/articleList'],resolve),
              meta: { title: '文章列表' }
            },
            {
              path: '/articleDetails',
              component: resolve => require(['@/components/page/article/articleList/articleDetails'],resolve),
              meta: { title: '文章详情' }
            }
          ]
        },
        {
          path: '/user',
          component: resolve => require(['@/components/page/user/user'],resolve), 
          children: [
            {
              path: '/expenseList',
              component: resolve => require(['@/components/page/user/expenseList/expenseList'],resolve), 
              meta: { title: '用户消费列表' },
            }
          ]
        },
        {
          path: '/financing',
          component: resolve => require(['@/components/page/financing/financing'],resolve), 
          children: [
            {
              path: '/record',
              component: resolve => require(['@/components/page/financing/record/record'],resolve),
              meta: { title: '核销记录' },
              children: []
            },
            {
              path: '/deposit',
              component: resolve => require(['@/components/page/financing/deposit/deposit'],resolve),
              meta: { title: '押金退款' },
              children: []
            }
          ]
        },
        {
          path: '/headerInfo',
          component: resolve => require(['@/components/page/headerInfo/headerInfo'],resolve), 
          children: [
            {
              path: '/message',
              component: resolve => require(['@/components/page/headerInfo/message/message'],resolve), 
              meta: { title: '消息通知' }
            },
            {
              path: '/version',
              component: resolve => require(['@/components/page/headerInfo/version/version'],resolve), 
              meta: { title: '版本更新管理' }
            }
          ]
        }
      ]
    }
  ]
})
